package org.openurp.edu.student.info.model

import java.util.GregorianCalendar
import scala.collection.mutable.Buffer
import org.beangle.commons.lang.time.WeekDay.WeekDay
import org.beangle.data.model.TemporalOn
import org.beangle.data.model.IntId
import org.beangle.data.model.Named
import org.beangle.data.model.Coded
import scala.beans.BeanProperty

/**
 * @author xinzhou
 */
/**
 * 教学日历方案
 * 校历（日历方案）记录了一整套学年学期的设置，是连贯性学年学期设置的集合，也可称日历方案。
 */
/**
 * 学年学期 </p> 代表的是具体学年度的 学期设置，每个学期的起始日期（起始日期要以星期日作为第一天）和结束日期。
 */
class Semester extends IntId with Named with TemporalOn {

  @BeanProperty
  var code: String = _

  /**学年度,一般为yyyy-yyyy或者yyyy的格式*/
  @BeanProperty
  var schoolYear: String = _

  def startWeek(weekDay: WeekDay): Int = {
    val gc = new GregorianCalendar();
    gc.setTime(beginOn);
    gc.setFirstDayOfWeek(weekDay.index)
    gc.get(java.util.Calendar.WEEK_OF_YEAR);
  }

  def this(id: Integer, code: String, schoolYear: String, name: String) {
    this()
    this.id = id
    this.code = code
    this.schoolYear = schoolYear
    this.name = name
  }

}